package com.ngmaster.socket.message;

import com.ngmaster.socket.ProtocolMessage;

import java.util.Arrays;

/**
 * 1.修改定时冲洗时间
 * 接收应答一致
 * 2.读取定时冲洗时间
 * 接收0000
 * 应答xxxx
 */
public class ReadOrModifyWashFixedTimeMessage extends ProtocolMessage {

    /** 修改定时冲洗时间为N分钟 */
    private short minutes;

    public short getMinutes() {
        return minutes;
    }

    public void setMinutes(short minutes) {
        this.minutes = minutes;
    }

    @Override
    public void onSerial() {
        this.byteArray.writeShort(this.minutes);
    }

    @Override
    public void onDeserialize() {
        this.minutes = this.byteArray.readShort();
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("ReadOrModifyWashFixedTimeMessage{");
        sb.append("minutes=").append(minutes);
        sb.append(", imeiBytes=").append(Arrays.toString(imeiBytes));
        sb.append(", imei='").append(imei).append('\'');
        sb.append(", cmd=").append(cmd);
        sb.append(", dataLength=").append(dataLength);
        sb.append(", crc=").append(crc);
        sb.append(", crcHex='").append(crcHex).append('\'');
        sb.append(", byteArray=").append(byteArray);
        sb.append('}');
        return sb.toString();
    }
}
